/**
 * Created at 2018/7/12
 * Author: SaintLee
 * <p>
 * Copyright 2018 SaintLee
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cn.com.saintlee.id;

import java.util.Date;

/**
 * @Description: <p>ID生成器</p>
 * @Copyright: <p>Copyright (c) 2018</p>
 * @Company: <p>saintlee.com.cn inc.</p>
 * @date: 2018/7/12 11:44
 * @author: SaintLee
 * @version: v1.0.0
 */
public interface IdGenerator {

    /**
     * 设置序列
     *
     * @param value 序列值
     */
    void set(int value);

    /**
     * 设置序列
     *
     * @param value      序列值
     * @param expireTime 过期时间
     */
    void set(int value, Date expireTime);

    /**
     * 获取序列值，key不过期
     */
    Long next();

    /**
     * 获取序列值
     *
     * @param expireTime 过期时间
     */
    Long next(Date expireTime);

    /**
     * 增量序列值，key不过期
     *
     * @param increment 增量
     */
    Long next(int increment);

    /**
     * 增量序列值
     *
     * @param increment  增量
     * @param expireTime 过期时间
     */
    Long next(int increment, Date expireTime);

}
